package com.haiersen.sign.attendance.service;

import java.util.Date;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.haiersen.sign.attendance.dao.AttendanceRecordMapper;
import com.haiersen.sign.attendance.entity.AttendanceRecord;
import com.haiersen.sign.utils.IDGenerator;

@Service
public class AttendanceRecordService implements IAttendanceRecordService{
	@Autowired
	private AttendanceRecordMapper attendanceRecordMapper;

	@Override
	public void addAttendance(String userId, String signEquipment, String iBeaconId, boolean type) {
		
		AttendanceRecord attendanceRecord=new AttendanceRecord();
		attendanceRecord.setRecordId(IDGenerator.gen32UUID());
		attendanceRecord.setAddTime(new Date());
		attendanceRecord.setSignTime(new Date());
		attendanceRecord.setUserId(userId);
		attendanceRecord.setSignEquipment(signEquipment);
		attendanceRecord.setType(type);
		attendanceRecord.setIbeaconId(iBeaconId);
		
		attendanceRecordMapper.insert(attendanceRecord);
	}
	
}
